package component.global.manager
{
	import flash.events.Event;
	import flash.utils.getQualifiedClassName;

	public class FocusMgr
	{
		public function FocusMgr()
		{
		}
		
		private static var _instance:FocusMgr
		
		public static function get Instance():FocusMgr{
			if(_instance == null){
				_instance = new FocusMgr();
			}
			return _instance;
		}
		
		private static var _focusInstance:String;
		
		public function setup():void{
			EventMgr.Instance.addEvent(StageManager.Instance.stage,[Event.ENTER_FRAME],[__onEnterFrame]);
		}
		
		private function __onEnterFrame(e:Event):void{
			if(StageManager.Instance.stage.focus){
				if(_focusInstance != StageManager.Instance.stage.focus.name){
					_focusInstance = StageManager.Instance.stage.focus.name;
					var str:String = _focusInstance + " " + getQualifiedClassName(StageManager.Instance.stage.focus);
					trace(str);
				}
			} else {
				if(_focusInstance != getQualifiedClassName(StageManager.Instance.stage.focus)){
					_focusInstance = "null";
					trace("null");
				}
			}
		}
	}
}